<template>
	<view class="waikuang">
		<video id="myVideo" src="https://www.cs0771.com/MallSer/upload/meifa/af32aabe-1b50-4579-af1f-960d26b57c37.mp4"
		                    @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu danmu-btn controls></video>
		<view class="shiplieb" v-for="(item,index) in allData" :key="index">
			<!-- <video id="videoPlayer" class="shipcc" name="media" muted="muted" controls="controls" autoplay="autoplay"
				loop>
				<source :src="item.video" type="video/mp4">
			</video> -->

			<view class="pydner">
				<view class="biaoti">
					<view>{{item.scshij}}</view>
						<view class="hegen" v-if="item.shzt==0">未审核</view>
					<view class="hegen" v-if="item.shzt==1">非常好</view>
					<view class="hegen" v-if="item.shzt==2">很好</view>
					<view class="hegen" v-if="item.shzt==3">合格</view>
					<view class="hegen" v-if="item.shzt==4">差</view>
				</view>
				<view class="pingdian" v-if="!item.shzt==0||!item.shzt==4">卫生达标，请保持</view>
				<view class="pingdian" v-else>卫生不达标</view>
			</view>
		</view>
		<view class="fabuann" @click="videoUpload()">
			<view class="scanniu">上传卫生视频</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				videoSrc: '',
				yg_id: '',
				allData: [],
				     danmuList: [{
				                    text: '第 1s 出现的弹幕',
				                    color: '#ff0000',
				                    time: 1
				                },
				                {
				                    text: '第 3s 出现的弹幕',
				                    color: '#ff00ff',
				                    time: 3
				                }
				            ],
			}
		},
		onLoad() {
			var that = this;
			uni.getStorage({
				key: 'user_key',
				complete: function(res) {
					// console.log(666,res)
					that.yg_id = res.data.id;
					that.getHygieneVidio();
				}
			})
		},
		methods: {
			   videoErrorCallback: function(e) {
			            uni.showModal({
			                content: e.target.errMsg,
			                showCancel: false
			            })
			        },
			//跳转到上传页面
			videoUpload() {
				uni.navigateTo({
					url: '../videoUpload/videoUpload'
				})
			},
			//查询卫生视频列表
			getHygieneVidio() {
				let _that = this;
				uni.request({
					url: getApp().globalData.url + '/client/GetGrwesp',
					method: 'GET',
					data: {
						id: _that.yg_id,
					},
					header: {
						"Content-Type": "application/json"
					},
					success: function(res) {
						console.log(555, res)
						if (res.data.code == 200 && res.data.msg == '查询成功') {
							_that.allData = [];
							_that.allData = res.data.data;
						} else {
							uni.showToast({
								icon: 'none',
								position: 'center',
								title: "请求出现异常！"
							});
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.waikuang {
		width: 690rpx;
		padding: 30rpx 30rpx 100rpx 30rpx;

		.fabuann {
			position: fixed;
			bottom: 0;
			left: 0;
			background-color: #FFFFFF;
			width: 750rpx;
			height: 120rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			z-index: 999;

			.scanniu {
				width: 650rpx;
				height: 80rpx;
				background: #ff007f;
				color: #ffffff;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}

		.shiplieb {
			width: 690rpx;
			// height: 450rpx;
			background: #f0f0f0;
			border-radius: 20rpx;
			margin-bottom: 20rpx;

			.shipcc {
				width: 690rpx;
				height: 300rpx;
				border-radius: 20rpx 20rpx 0 0;
			}

			.pydner {
				padding: 0 20rpx 20rpx 20rpx;

				.biaoti {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.hegen {
						font-weight: bold;
						color: #ff007f;
					}
				}

				.pingdian {
					width: 650rpx;
					margin-top: 10rpx;
					font-size: 25rpx;
					color: #91949a;
					display: -webkit-box;
					word-break: break-all;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					text-overflow: ellipsis;
				}
			}
		}
	}
</style>
